<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<style>
    #gaista{margin-left: 10px}

    .show-minimg .li{width: 100px;height: 120px;text-align: center;border: 1px solid #E4E4E4;cursor: pointer;
        position: relative;float: left;margin-right: 15px;margin-bottom: 15px;color: #E4E4E4}
    .show-minimg .lilan{border: 1px solid #409EFF;color: #409EFF}
    .show-minimg .li img{height: 100%;width: 100%}
    .show-minimg .li .imgdiv{width: 98px;height: 90px}
    .show-minimg .li .imgdiv i{font-size: 40px;margin-top: 30px;}
    .show-minimg .filetit{color: #777777;text-align: center;line-height: 30px;overflow: hidden;
        text-overflow:ellipsis;white-space: nowrap;padding: 0 10px;}
    .show-minimg .li .cheng{display: none}
    .show-minimg .li .cheng .shan{color: #F56C6C;font-size: 25px;position: absolute;top: -15px;right: -16px}
    .show-minimg .li .jia{font-size: 40px;}
    .show-minimg .li .dea-ext{font-size: 35px;padding-top: 20px}
</style>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">整改通知编号</td><td><span id="number" class="tv"></span><span id="gaista" class="colorlan"></span></td><td class="tt">项目名称</td><td id="enginname" class="colorlan tv"></td></tr>
                <tr><td class="tt">关联巡检</td><td id="xun_number" class="colorlan tv"></td><td class="tt">整改负责人</td><td id="fuzeer_name" class="tv"></td></tr>
                <tr><td class="tt">要求整改期限</td><td id="dt" class="tv"></td><td class="tt">复检人</td><td id="fujianer_name" class="tv"></td></tr>
                <tr><td class="tt">下发部门</td><td id="deptid_name" class="tv"></td><td class="tt">下发日期</td><td id="created_at" class="tv"></td></tr>
                <tr><td class="tt">备注</td><td id="explain" colspan="3" class="tv"></td></tr>
                <tr>
                    <td class="tt">需整改的问题</td>
                    <td colspan="3">
                        <div class="layui-col-md12">
                            <div class="table-box">
                                <table class="layui-table table-detail">
                                    <tbody id="list_list2">

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes">
            <div class="title">整改结果</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">整改完成时间</td><td id="gaidt" class="tv"></td><td class="tt">其他说明</td><td id="gaicon" class="tv"></td></tr>
                <tr><td class="tt">复检时间</td><td id="fudt" class="tv"></td><td class="tt">复检状态</td><td id="fusta_name" class="tv"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>



        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_engin_zheng_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                var xunidinfo = res.data.xunidinfo;

                $("#enginname").text(engininfo.name).click(function () {
                    openPage('../engin/show.php?id='+engininfo.id);
                });
                $("#xun_number").text(xunidinfo.number).click(function () {
                    openPage('../engin_xun/show.php?id='+xunidinfo.id);
                });

                $("#number").text(data.number);
                $("#dt").text(data.dt);
                $("#fuzeer_name").text(data.fuzeer_name);
                $("#fujianer_name").text(data.fujianer_name);
                $("#deptid_name").text(data.deptid_name);
                $("#created_at").text(data.created_at);
                $("#explain").text(data.explain);


                $("#gaidt").text(data.gaidt);
                $("#gaicon").text(data.gaicon);
                $("#fudt").text(data.fudt);
                $("#fusta_name").text(data.fusta_name);

                if(data.fusta_name){
                    $("#gaista").html(data.gaista_name+'-'+data.fusta_name);
                }else{
                    $("#gaista").html(data.gaista_name);
                }




                list_list2(res.data.list);
                // $(".pageshowtitle").text('整改通知');


                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('engin_zheng', param_id);
        showpage_dropopt();
    });

    function list_list2(data) {
        var str = '';
        var nums = 1;


        for (var key in data){
            str += '<tr>';
            str += '<td style="width:15%" class="colorlan">检查项'+nums+'</td>';
            str += '<td style="width:35%">'+data[key].jiantype+'：'+data[key].name+'（说明：'+data[key].shuo+'）</td>';
            str += '<td style="width:15%">是否整改</td>';
            str += '<td style="width:35%">'+data[key].isgai+'</td>';
            str += '</tr>';

            str += '<tr>';
            str += '<td style="width:15%">整改措施</td>';
            str += '<td style="width:35%">'+data[key].gaicon+data[key].gaicon+'</td>';
            str += '<td style="width:15%">整改说明</td>';
            str += '<td style="width:35%">'+data[key].gaishuo+'</td>';
            str += '</tr>';

            str += '<tr>';
            str += '<td style="width:15%">现场图片（整改前）</td>';
            str += '<td style="width:35%"><div id="minfilesLeft'+nums+'"><div class="show-minimg"></div></div></td>';
            str += '<td style="width:15%">现场图片（整改后）</td>';
            str += '<td style="width:35%"><div id="minfilesRight'+nums+'"><div class="show-minimg"></div></div></td>';
            str += '</tr>';

            str += '<tr>';
            str += '<td style="width:15%">复检结果</td>';
            str += '<td style="width:35%">'+data[key].fuguo+'</td>';
            str += '<td style="width:15%">复检说明</td>';
            str += '<td style="width:35%">'+data[key].fushuo+'</td>';
            str += '</tr>';


            str += '<tr style="height: 5px!important;background-color: #ccc;padding: 0!important;">';
            str += '<td colspan="4" style="min-height: 5px!important;line-height: 5px!important;padding: 0!important;"></td>';
            str += '</tr>';
            nums++;
        }

        if(!str){
            str = file_none(4);
        }
        file_assign('#list_list2', str);

        nums = 1;
        for (var key in data){
            public_min_file_load_mm('minfilesLeft'+nums, data[key].filearr);
            public_min_file_load_mm('minfilesRight'+nums, data[key].gaifilearr);
            nums++;
        }
        setWidth();
    }



    function setWidth() {
        var tdw = ($('#showBox').width() - 270) / 2;
        $('#showBox .table-box .table-detail tr td:nth-of-type(even)').css('width',tdw+'px');
    }



    function public_min_file_value_mm(dom) {
        var files = [];
        $('#'+dom+' .show-minimg .li').each(function(){
            var fileid = $(this).attr('id') || '';
            if(fileid){
                files.push(fileid);
            }
        });
        return files.join(',');
    }



    function public_min_file_load_mm(dom, data=[], isedit=0) {
        $("#"+dom).find('.upload_file_btn').click(function () {
            upload_min_file_btn_mm(dom);
        });
        if(data.length > 0){
            for (var key in data){
                var filename = data[key].name;
                var filepath = data[key].encpath;
                var fileurl = get_file_complete(filepath);
                var id = data[key].id;
                var fileext = data[key].ext;

                var imgstr = '';
                imgstr += '<div class="li" id='+id+'>';
                imgstr += '<div class="imgdiv">';
                if(fileext == 'png' || fileext == 'pneg' || fileext == 'jpg' || fileext == 'jpeg' || fileext == 'gif'){
                    imgstr += '<img src="'+fileurl+'" data_src="'+fileurl+'">';
                }else if(fileext == 'pdf'){
                    imgstr += '<div class="dea-ext" onclick="upload_files_viewer_pdf_show(\''+fileurl+'\')">'+fileext+'</div>';
                }else if(fileext == 'doc' || fileext == 'docx' || fileext == 'xls' || fileext == 'xlsx' || fileext == 'ppt' || fileext == 'pptx'){
                    imgstr += '<div class="dea-ext" onclick="upload_files_vieweroffice_show(\''+fileurl+'\')">'+fileext+'</div>';
                }else{
                    imgstr += '<div class="dea-ext" onclick="upload_files_show_yulan_not()">'+fileext+'</div>';
                }
                imgstr += '</div>';
                imgstr += '<div class="filetit">'+filename+'</div>';
                if(isedit > 0){
                    imgstr += '<span class="cheng">';
                    imgstr += '<i class="fa fa-times-circle shan" onclick="upload_min_del_file_mm(\''+dom+'\','+id+')"></i>';
                    imgstr += '</span>';
                }
                imgstr += '</div>';
                $('#'+dom+' .show-minimg').append(imgstr);
            }

            upload_min_file_viewer_mm(dom)
        }

        upload_min_init_mouse_mm(dom);
    }

    function upload_min_file_btn_mm(dom, isimg=0){
        layui.use('layer',function(){
            var layer = layui.layer;
            layer.open({
                type: 2,
                title: '上传文件',
                maxmin: true,
                area: ['600px', '400px'],
                content: './upload_min.php?isimg='+isimg+'&dom='+dom,
                cancel :function (index) {
                    layer.confirm("正在上传文件信息，是否直接关闭窗口？",function (conindex) {
                        layer.close(conindex);
                        layer.close(index);
                    });
                    return false;
                }
            });
        });
    }


    var viewerMinObj={}
    function upload_min_file_viewer_mm(dom){
        viewerMinObj[dom] = new Viewer(document.getElementById(dom));
    }

    function upload_min_del_file_mm(dom, id){
        layer.confirm('确定要删除该文件吗？',function(index){
            $("#"+dom+" .show-minimg .li").each(function () {
                if($(this).attr('id') == id){
                    $(this).remove();
                }
            });

            upload_min_file_viewer_mm(dom);
            layer.close(index);
        });
    }


    function upload_min_init_mouse_mm(dom) {
        $("#"+dom+" .show-minimg .li").on("mouseover",function(){
            $(this).find('.filetit').addClass('colorlan');
            $(this).find('.cheng').show();
            $(this).addClass('lilan');
        });
        $("#"+dom+" .show-minimg .li").on("mouseout",function(){
            $(this).find('.filetit').removeClass('colorlan');
            $(this).find('.cheng').hide();
            $(this).removeClass('lilan');
        });
    }

</script>
</body>
</html>




